package cpoo.globalMotion;

import java.awt.Point;

public class MotionVector {
	public Point beg;
	public Point end;
	public double x, y;
	
	public MotionVector() {
		
	}
	
	public MotionVector (Point beg, Point end){
		this.beg = beg;
		this.end = end;
		x = end.x - beg.x;
		y = end.y - beg.y;
	}
	
	public double getLength() {
		return Math.sqrt(x*x + y*y);
	}
	
	public void normalize() {
		x = x / getLength();
	    y = y / getLength();
	}
	 
	public double angle(MotionVector mv) {
		return Math.acos(((x * mv.x) + (y * mv.y))/(this.getLength() + mv.getLength()));
	}
}
